|
|
|
|
|
|
|
Declare Sub ShellAbout Lib "shell.dll" (ByVal hWindOwner As Integer,
_ ByVal lpszAppName As String, ByVal lpszMoreInfo As String,
_ ByVal hIcon As Integer)
#Else
Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long,
_ ByVal lpHelpFile As String, ByVal wCommand As Long,
_ ByVal dwData As Any) As Long
Declare Function ShellAbout Lib "shell32.dll"
_ Alias "ShellAboutA" (ByVal hwnd As Long,
_ ByVal szApp As String, ByVal szOtherStuff As String,
_ ByVal hIcon As Long) As Long
#End If |
|
|
|
|
|
|
|
|
Notice that you used the compilation directive (#if) to insert the code so that this application runs under the 16-bit version of Visual Basic 4. You then used the #Else directive to insert the 32-bit version. By doing this, the application runs under either version of Visual Basic (16- or 32-bit), or Visual Basic 5. |
|
|
|
|
|
|
|
|
The final entries into the general declaration section are to define the constants that are called by the Help menu items: |
|
|
|
|
|
|
|
|
Global Const HELP_QUIT = 2
Global Const HELP_INDEX = 3
Global Const HELP_HELPONHELP = 4
Global Const HELP_PARTIALKEY = &H105 |
|
|
|
|
|
|
|
|
The HelpFile procedure performs the following tasks: |
|
|
|
|
|
|
|
|
Sub HelpFile (frmForm As Form, nHelpCmd As Integer)
Dim i As Integer
Dim nFlag As Integer
Dim aData As Variant |
|
|
|
|
|
|
|
|
· It tests for the declaration of a help file and returns a message if none is declared: |
|
|
|
|
|
|
|
|
If Len(LTrim(RTrim(App.HelpFile))) = 0 Then
MsgBox "No Help File Available"
GoTo HelpFile_Exit
End If |
|
|
|
|
|
|
|
|
· It flips a switch depending upon which value has been selected. This switch is set to True if a valid case is passed: |
|
|
|
|
|
|
|
|
Select Case nHelpCmd
Case Is = HELP_QUIT
nFlag = True
Case Is = HELP_INDEX
nFlag = True
Case Is = HELP_HELPONHELP
nFlag = True
Case Is = HELP_PARTIALKEY
nFlag = True
Case Else
nFlag = False 'invalid command!
End Select |
|
|
|
|
|